home *** CD-ROM | disk | FTP | other *** search
/ Aminet 3 / Aminet 3 - July 1994.iso / Aminet / gfx / pbm / manuals.lha / netpbm / man / pnmnlfilt.man < prev    next >
Text File  |  1994-03-01  |  7KB  |  199 lines

  1.  
  2.  
  3.  
  4.      pnmnlfilt(1)         AMIGA (5 February 1993)         pnmnlfilt(1)
  5.  
  6.  
  7.  
  8.      NAME
  9.           pnmnlfilt - non-linear filters: smooth, alpha trim mean,
  10.           optimal estimation smoothing, edge enhancement.
  11.  
  12.      SYNOPSIS
  13.           pnmnlfilt alpha radius [pnmfile]
  14.  
  15.      DESCRIPTION
  16.           This is something of a swiss army knife filter. It has 3
  17.           distinct operating modes. In all of the modes each pixel in
  18.           the image is examined and processed according to it and its
  19.           surrounding pixels values. Rather than using the 9 pixels in
  20.           a 3x3 block, 7 hexagonal area samples are taken, the size of
  21.           the hexagons being controlled by the radius parameter. A
  22.           radius value of 0.3333 means that the 7 hexagons exactly fit
  23.           into the center pixel (ie.  there will be no filtering
  24.           effect). A radius value of 1.0 means that the 7 hexagons
  25.           exactly fit a 3x3 pixel array.
  26.  
  27.      Alpha trimmed mean filter.    (0.0 <= alpha
  28.           The value of the center pixel will be replaced by the mean
  29.           of the 7 hexagon values, but the 7 values are sorted by size
  30.           and the top and bottom alpha portion of the 7 are excluded
  31.           from the mean.  This implies that an alpha value of 0.0
  32.           gives the same sort of output as a normal convolution (ie.
  33.           averaging or smoothing filter), where radius will determine
  34.           the "strength" of the filter. A good value to start from for
  35.           subtle filtering is alpha = 0.0, radius = 0.55 For a more
  36.           blatant effect, try alpha 0.0 and radius 1.0
  37.  
  38.           An alpha value of 0.5 will cause the median value of the 7
  39.           hexagons to be used to replace the center pixel value. This
  40.           sort of filter is good for eliminating "pop" or single pixel
  41.           noise from an image without spreading the noise out or
  42.           smudging features on the image. Judicious use of the radius
  43.           parameter will fine tune the filtering. Intermediate values
  44.           of alpha give effects somewhere between smoothing and "pop"
  45.           noise reduction. For subtle filtering try starting with
  46.           values of alpha = 0.4, radius = 0.6  For a more blatant
  47.           effect try alpha = 0.5, radius = 1.0
  48.  
  49.      Optimal estimation smoothing. (1.0 <= alpha
  50.           This type of filter applies a smoothing filter adaptively
  51.           over the image.  For each pixel the variance of the
  52.           surrounding hexagon values is calculated, and the amount of
  53.           smoothing is made inversely proportional to it. The idea is
  54.           that if the variance is small then it is due to noise in the
  55.           image, while if the variance is large, it is because of
  56.           "wanted" image features. As usual the radius parameter
  57.           controls the effective radius, but it probably advisable to
  58.           leave the radius between 0.8 and 1.0 for the variance
  59.           calculation to be meaningful.  The alpha parameter sets the
  60.  
  61.  
  62.  
  63.      Page 1                                           (printed 3/1/94)
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.      pnmnlfilt(1)         AMIGA (5 February 1993)         pnmnlfilt(1)
  71.  
  72.  
  73.  
  74.           noise threshold, over which less smoothing will be done.
  75.           This means that small values of alpha will give the most
  76.           subtle filtering effect, while large values will tend to
  77.           smooth all parts of the image. You could start with values
  78.           like alpha = 1.2, radius = 1.0 and try increasing or
  79.           decreasing the alpha parameter to get the desired effect.
  80.           This type of filter is best for filtering out dithering
  81.           noise in both bitmap and color images.
  82.  
  83.      Edge enhancement. (-0.1 >= alpha >=
  84.           This is the opposite type of filter to the smoothing filter.
  85.           It enhances edges. The alpha parameter controls the amount
  86.           of edge enhancement, from subtle (-0.1) to blatant (-0.9).
  87.           The radius parameter controls the effective radius as usual,
  88.           but useful values are between 0.5 and 0.9. Try starting with
  89.           values of alpha = 0.3, radius = 0.8
  90.  
  91.      Combination use.
  92.           The various modes of pnmnlfilt can be used one after the
  93.           other to get the desired result. For instance to turn a
  94.           monochrome dithered image into a grayscale image you could
  95.           try one or two passes of the smoothing filter, followed by a
  96.           pass of the optimal estimation filter, then some subtle edge
  97.           enhancement. Note that using edge enhancement is only likely
  98.           to be useful after one of the non-linear filters (alpha
  99.           trimmed mean or optimal estimation filter), as edge
  100.           enhancement is the direct opposite of smoothing.
  101.  
  102.           For reducing color quantization noise in images (ie. turning
  103.           .gif files back into 24 bit files) you could try a pass of
  104.           the optimal estimation filter (alpha 1.2, radius 1.0), a
  105.           pass of the median filter (alpha 0.5, radius 0.55), and
  106.           possibly a pass of the edge enhancement filter.  Several
  107.           passes of the optimal estimation filter with declining alpha
  108.           values are more effective than a single pass with a large
  109.           alpha value.  As usual, there is a tradeoff between
  110.           filtering effectiveness and loosing detail. Experimentation
  111.           is encouraged.
  112.  
  113.      References:
  114.           The alpha-trimmed mean filter is based on the description in
  115.           IEEE CG&A May 1990 Page 23 by Mark E. Lee and Richard A.
  116.           Redner, and has been enhanced to allow continuous alpha
  117.           adjustment.
  118.  
  119.           The optimal estimation filter is taken from an article
  120.           "Converting Dithered Images Back to Gray Scale" by Allen
  121.           Stenger, Dr Dobb's Journal, November 1992, and this article
  122.           references "Digital Image Enhancement and Noise Filtering by
  123.           Use of Local Statistics", Jong-Sen Lee, IEEE Transactions on
  124.           Pattern Analysis and Machine Intelligence, March 1980.
  125.  
  126.  
  127.  
  128.  
  129.      Page 2                                           (printed 3/1/94)
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.      pnmnlfilt(1)         AMIGA (5 February 1993)         pnmnlfilt(1)
  137.  
  138.  
  139.  
  140.           The edge enhancement details are from pgmenhance(1), which
  141.           is taken from Philip R. Thompson's "xim" program, which in
  142.           turn took it from section 6 of "Digital Halftones by Dot
  143.           Diffusion", D. E. Knuth, ACM Transaction on Graphics Vol. 6,
  144.           No. 4, October 1987, which in turn got it from two 1976
  145.           papers by J. F. Jarvis et. al.
  146.  
  147.      SEE ALSO
  148.           pgmenhance(1), pnmconvol(1), pnm(5)
  149.  
  150.      BUGS
  151.           Integers and tables may overflow if PPM_MAXMAXVAL is greater
  152.           than 255.
  153.  
  154.      AUTHOR
  155.           Graeme W. Gill    graeme@labtam.oz.au
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.      Page 3                                           (printed 3/1/94)
  196.  
  197.  
  198.  
  199.